/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.dosideas.restlet.resource;

import com.dosideas.restlet.domain.Alumno;
import java.util.ArrayList;
import java.util.Collection;
import org.restlet.resource.Get;
import org.restlet.resource.Post;
import org.restlet.resource.ServerResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AlumnoResource extends ServerResource {

    private static final Logger log = LoggerFactory.getLogger(CursosPorAlumnoResource.class);
    
    @Get
    public Collection<Alumno> buscar() {
        Collection<Alumno> alumnos = new ArrayList<Alumno>();
        Alumno alumno = new Alumno();
        alumno.setId(1L);
        alumno.setNombre("Bart");
        alumno.setApellido("Simpson");
        alumno.setEmail("bart.simpson@gmail.com");
        alumnos.add(alumno);

        alumno = new Alumno();
        alumno.setId(2L);
        alumno.setNombre("Jason");
        alumno.setApellido("Bourne");
        alumno.setEmail("jason.bourne@gmail.com");
        alumnos.add(alumno);

        return alumnos;
    }
    
    @Post
    public Alumno alta(Alumno alumno) {
        log.debug("- Alta de alumno -");
        log.debug("-- Id: " + alumno.getId());
        log.debug("-- Nombre: " + alumno.getNombre());
        log.debug("-- Apellido: " + alumno.getApellido());
        log.debug("-- Email: " + alumno.getEmail());

        return alumno;
    }
    
}
